#ifndef _UTILS_OPENGLAPP_H_
#define _UTILS_OPENGLAPP_H_

#include "OpenglAppFramework/inc/Shader.h"
#include "OpenglAppFramework/inc/Scene.h"
#include <string>

class OpenglApp {
public:
    OpenglApp();
    ~OpenglApp();
    int init(const std::string& title, const std::string& scene_file);
    int start();
    void destroy();

    void handleInput();
    void mainLoop();
    void mainLoopExtrel();
    void afterMainLoop();

    void setIsShowFps(bool flag);
    Scene& manager();

protected:
    GLFWwindow* m_window;
    double m_cur_time;
    double m_last_frame_time;
private:
    void render2D();
    void renderShadowMap();
    void renderObjects();
    void calculateFps();

    bool m_is_show_fps;
    unsigned int m_frame_cnt;
    double m_last_check_time;
    uint32_t m_frame_debug_vao_id;
    uint32_t m_frame_debug_vbo_id;
    Shader m_default_shader;
    Shader m_frame_debug_shader;
    Scene m_scene;
};

#endif//_UTILS_OPENGLAPP_H_
